5.3. Modify omp trap 1.c so that a. it uses the first block of code on page 222, and b. the time used by the parallel block is timed using the OpenMP function omp get wtime(). The syntax is double omp get wtime(voi
d) It returns the number of seconds that have passed since some time in the past. For details on taking timings, see Section 2.6.4. Also recall that OpenMP has a barrier directive:
# pragma omp barrier
Now find a system with at least two cores and time the program with
c. one thread and a large value of n, and
d. two threads and the same value of n.
What happens? Download omp trap 2.c from the book's website. How does its performance compare? Explain your answers.
 
 
View Solution
 
 
 
<< Back Next >>